<?php
/**
 * Description: 检查退款详情
 *
 * @author      Eden
 * @datetime    2016/12/20 11:04
 * @copyright   Beijing CmsTop Technology Co.,Ltd.
 */

class Postage2_Model extends API_Model
{

    /**
     * 初始化
     */
    public function __construct()
    {
        parent::__construct();
    }

    public function run($params = array())
    {
        $send['state'] = true;
        do {

            if (empty($params['userId'])) {
                $send['state'] = false;
                $send['error'] = '参数错误';
                break;
            }

            $this->load->model('common/ExpressPrice_Model', 'e');
            $p = $this->e->price($params['userId']);

            $return = [
                'total' => intval($p['total']),
                'total_format' => money_format('%i', $p['total'] / 100)
            ];

            $send['data']  = $return;

        } while(false);
        $this->output->send($send);
    }

}
